//
//  HD_HSP_MineSelect_ViewController.m
//  HDLiaoNingMeseum
//
//  Created by HDHaoShaoPeng on 2017/8/7.
//  Copyright © 2017年 HDNiuKuiming. All rights reserved.
//

#import "HD_HSP_MineSelect_ViewController.h"
#import "HD_HSP_Friends_ViewController.h"
#import "HD_HSP_MineMessage_ViewController.h"
#import "HD_LY_NetHelper.h"


@interface HD_HSP_MineSelect_ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *myTItle;
@property (weak, nonatomic) IBOutlet UILabel *myPartnerLabel;
@property (weak, nonatomic) IBOutlet UILabel *mineLabel;

@end


static HDDeclare *declare;
@implementation HD_HSP_MineSelect_ViewController
{
    HD_HSP_Mine_Model *_currentModel;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    declare = [HDDeclare sharedDeclare];
    
    self.myTItle.text = declare.minePage;
    self.myTItle.font = [UIFont fontWithName:@"FZQKBYSJW--GB1-0" size:18.0];
    
    self.myPartnerLabel.text = declare.myFriend;
    self.myPartnerLabel.font = [UIFont fontWithName:@"FZQKBYSJW--GB1-0" size:18.0];
    
    self.mineLabel.text = declare.mineInfo;
    self.mineLabel.font = [UIFont fontWithName:@"FZQKBYSJW--GB1-0" size:18.0];
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    [self getMineMessage];
}

-(void)getMineMessage
{
    NSString *requestUrl = [NSString stringWithFormat:@"%@%@",[HDDeclare IP_Request_Header],@"index.php?g=mapi&m=User&a=get_user_info"];
    NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:declare.userID,@"device_id",@"2",@"app_kind", nil];
    [HD_LY_NetHelper requestWithType:POST withUrl:requestUrl withParams:params toShowVC:self success:^(id response) {
        NSDictionary *dicData = response;
        if ([dicData[@"status"] intValue] == 1)
        {
            NSDictionary *tempDic = [dicData objectForKey:@"data"];
            declare.group_name = [tempDic objectForKey:@"group_id"];
            declare.nickName = [tempDic objectForKey:@"nick_name"];            
        }else {
        }
    } fail:^(NSError *error) {
        
    } showHUD:NO isCache:NO];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
    
    if ([segue.identifier isEqualToString:@"showMineMessageLine"]) {
        HD_HSP_MineMessage_ViewController *vc = segue.destinationViewController;
        vc.model = sender;
    }
}

#pragma mark - 点击方法

- (IBAction)friendsClicked:(id)sender {
    HD_HSP_Friends_ViewController *firVC = [[UIStoryboard storyboardWithName:@"HD_HSP_Friends" bundle:nil] instantiateViewControllerWithIdentifier:@"HD_HSP_Friends_ViewController"];
    [self.navigationController pushViewController:firVC animated:YES];
}


- (IBAction)mineMessageClicked:(id)sender {
    [self performSegueWithIdentifier:@"showMineMessageLine" sender:_currentModel];
}


- (IBAction)backClicked:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}



@end
